package com.ustc.mvc.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.ustc.mvc.annotation.ActionAnnotation;
import com.ustc.mvc.annotation.ForwardAnnotation;
import com.ustc.mvc.form.ActionForm;
import com.ustc.mvc.form.LoginForm;

public class LoginAction implements Action {

	@ActionAnnotation(method = "/login", formClass = "com.ustc.mvc.form.LoginForm",
			forwards = {@ForwardAnnotation(name = "success", url = "view/success.jsp"), @ForwardAnnotation(name = "fail", url = "view/fail.jsp")})
	public String excute(HttpServletRequest request,
			ActionForm form, Map<String, String> forward) {
		LoginForm loginform = (LoginForm)form;
		if(loginform.getName().equals("yaorun")){
			return forward.get("success");
		}else{
			return forward.get("fail");
		}
	}

}
